//
//  ImmediateEvaluationTableViewCell.m
//  NewCommunity
//
//  Created by Aaron on 2017/10/16.
//  Copyright © 2017年 ZP. All rights reserved.
//

#import "ImmediateEvaluationTableViewCell.h"
#import "TggStarEvaluationView.h"

@interface ImmediateEvaluationTableViewCell()
//描述
@property (nonatomic, strong)UILabel * describeLabel;
//物流
//@property (nonatomic, strong)UILabel * logisticsLabel;
////态度
//@property (nonatomic, strong)UILabel * attitudeLabel;
@property (nonatomic, strong)UILabel * describeNumberLabel;
//@property (nonatomic, strong)UILabel * logisticsNumberLabel;
//@property (nonatomic, strong)UILabel * attitudeNumberLabel;
@property (nonatomic, strong)TggStarEvaluationView * describeView;
//@property (nonatomic, strong)TggStarEvaluationView * logisticsView;
//@property (nonatomic, strong)TggStarEvaluationView * attitudeView;

@property (nonatomic, assign)NSInteger describeCount;
@property (nonatomic, assign)NSInteger logisticsCount;
@property (nonatomic, assign)NSInteger attitudeCount;
@end

@implementation ImmediateEvaluationTableViewCell


-(instancetype)initWithCellIdentifier:(NSString *)cellID
{
    self = [super initWithCellIdentifier:cellID];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];

        self.describeCount = 5;
        self.logisticsCount = 5;
        self.attitudeCount = 5;
        
        _describeLabel = [[UILabel alloc]init];
        _describeLabel.font = [UIFont systemFontOfSize:15];
        _describeLabel.textColor = getColor(@"585858");
        _describeLabel.text = @"总体评价";
        [self.contentView addSubview:_describeLabel];
        
        _describeNumberLabel = [[UILabel alloc]init];
        _describeNumberLabel.text = @"5分";
        _describeNumberLabel.font = [UIFont systemFontOfSize:14];
        _describeNumberLabel.textColor = getColor(@"ff3b30");
        [self.contentView addSubview:_describeNumberLabel];
        

        WS(weakSelf);
        _describeView = [TggStarEvaluationView evaluationViewWithChooseStarBlock:^(NSUInteger count) {
            weakSelf.describeNumberLabel.text = [NSString stringWithFormat:@"%ld分", count];
            self.describeCount = count;
            if ([self.delegate respondsToSelector:@selector(scoreWithDescribe:logistics:attitude:)]) {
                [self.delegate scoreWithDescribe:self.describeCount logistics:self.logisticsCount attitude:self.attitudeCount];
            }
        }];
        _describeView.starCount = 5;
        _describeView.spacing = 0.1;
        [self.contentView addSubview:_describeView];
        
        
        _describeLabel.sd_layout.leftSpaceToView(self.contentView, 13)
        .topSpaceToView(self.contentView, 24)
        .widthIs(65)
        .heightIs(16);
        
        _describeView.sd_layout.leftSpaceToView(_describeLabel, 23)
        .topSpaceToView(self.contentView, 19)
        .widthIs(108)
        .heightIs(22);
        
        _describeNumberLabel.sd_layout.leftSpaceToView(_describeView, 18)
        .centerYEqualToView(_describeView)
        .rightSpaceToView(self.contentView, 20)
        .heightIs(15);

        [self setupAutoHeightWithBottomView:_describeView bottomMargin:22];
    }
    return self;
}

@end
